#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include "appconfig.h"
#include "appcontroller.h"


QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE
# pragma execution_character_set("utf-8")

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    void InitUI(); //Init // InitData //InitConnectSignals
    void InitConnectSignals();
signals:
    void tabChanged(int index);
    void recvBroadcast();
private slots:
    void on_tabWidget_currentChanged(int index);

    //broadcast func
    void on_lEdit_BroadcastAddr_textEdited(const QString &arg1);
    void on_lEdit_LocalPort_textEdited(const QString &arg1);
    void on_checkBox_IfHexRecv_stateChanged();
    void on_checkBox_IfAutoSend_stateChanged();
    void OnReceiveData(QByteArray& data);
    void OnReceiveBroadCastData(QByteArray& data);
    void OnReceiveMutiCastData(QByteArray& data);
    void OnReceiveUnicastData(QByteArray& data);
    void OnAutoSendData();
    void on_pBtn_Start_clicked();
    void on_pBtn_Send_clicked();
    void on_pBtn_ClearRecv_clicked();    
    void on_pBtn_ClearSend_clicked();

    //muticast func
    void on_pBtn_Start_muticast_clicked();

    void on_pBtn_ClearRecv_muticast_clicked();

    void on_pBtn_ClearSend_muticast_clicked();

    void on_pBtn_Send_muticast_clicked();



    void on_lEdit_localPort_muticast_textEdited(const QString &arg1);

    void on_lEdit_TargetAddr_muticast_textEdited(const QString &arg1);

    void on_lEdit_TargetPort_muticast_textChanged(const QString &arg1);

    void on_lEdit_localIP_muticast_textEdited(const QString &arg1);

    void on_chkBox_ifAutosend_muticast_stateChanged(int arg1);


   //unicast func
    void on_lEdit_localPort_unicast_textEdited();

    void on_lEdit_TargetIpAddr_unicast_textChanged();

    void on_lEdit_TargetPort_unicast_textChanged();

    void on_pBtn_Send_unicast_clicked();

    void on_pBtn_Clear_Send_unicast_clicked();

    void on_chkBox_IfAutoSend_unicast_stateChanged();

    void on_pBtn_Start_Unicast_clicked();

    void on_pBtn_clearRecv_unicat_clicked();

private:
    Ui::Widget *ui;   
    QString m_lastRecvMsg;
    QTimer *myTimer;

};
#endif // WIDGET_H
